package com.example.myapp.utils;

import com.example.myapp.login.LoginActivity;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class BootBroadcastReceiver extends BroadcastReceiver {
	@Override
	public void onReceive(Context context, Intent intent) {

		System.out.println("自启动程序即将执行");
//		Intent mBootIntent = new Intent(context, MainActivity.class);
//		// 下面这句话必须加上才能开机自动运行app的界面
//		mBootIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//		context.startActivity(mBootIntent);
		 if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){  
		      Intent sayHelloIntent=new Intent(context,LoginActivity.class);  
		      sayHelloIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  
		      context.startActivity(sayHelloIntent);  
		 }
	}
}
